{include file="common/_header-css"}
{include file="common/_jQuery"}
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="">首页</a>
            <a href="">评分管理</a>
            <a>
              <cite>员工管理</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form layui-col-space5">
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="search"  placeholder="请输入用户名&&账号" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn" id="button_search" type="button"><i class="layui-icon">&#xe615;</i></button>
                        </div>
                    </form>
                </div>
                <div class="layui-card-body layui-table-body layui-table-main">
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>员工号</th>
                            <th>用户名</th>
                            <th>周期描述</th>
                            <th>当前分数</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {empty name = 'list'}
                        <tr> 管理员暂未添加周期,暂无数据! </tr>
                        {else /}
                        {volist name="list" id="vo"}
                        <tr>
                            <td>{$vo.id}</td>
                            <td>{$vo.account}</td>
                            <td>{$vo.username}</td>
                            <td>{$vo.describe}</td>
                            <td>{$vo.total}</td>
                            <td class="td-manage">
                                <a title="添加分数"  onclick="xadmin.open(
                                    '添加分数','{:url(\'integral/integral_add\')}?integral_id={$vo.id}&user_id={$vo.user_id}&integral_cycle_id={$vo.integral_cycle_id}' +
                                     '&account={$vo.account}&total={$vo.total}'
                                ,600,600)" href="javascript:;">
                                    <i class="layui-icon">&#xe642;</i>
                                </a>
                            </td>
                        </tr>
                        {/volist}
                        {/empty}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        {$list|raw}
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['laydate','form'], function(){
        var laydate = layui.laydate;
        var  form = layui.form;

    });

    /*用户-停用*/
    function member_stop(obj,id){
        layer.confirm('确认要停用/启用吗？',function(index){
            if($(obj).parents("tr").find(".td-status").find('span').hasClass('layui-btn-disabled')){
                $.post('{:url(\'member/memberUpdateStatus\')}?type=1',{id:id,status:1},function (res) {
                    if (res.code == 200) {
                        $(obj).attr('title','启用')
                        $(obj).find('i').html('&#xe601;');

                        $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                        layer.msg('已启用!',{icon: 6,time:1000});
                    }else{
                        layer.msg(res.msg,{icon:5,time:500});
                    }
                });
            }else{
                $.post('{:url(\'member/memberUpdateStatus\')}?type=1',{id:id,status:2},function (res) {
                    if (res.code == 200) {
                        $(obj).attr('title','停用')
                        $(obj).find('i').html('&#xe62f;');

                        $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                        layer.msg('已停用!',{icon: 5,time:1000});
                    }else{
                        layer.msg(res.msg,{icon:5,time:500});
                    }
                });
            }
        });
    }
    $('#button_search').click(function () {
        let search = $('input[name=\'search\']').val();
        if (search == '')
        {
            layer.msg('搜索关键字不能为空!',{icon: 6,time:500});
            return false;
        }else{
            location.href='{:url(\'member/member_search\')}?search='+search;
        }
    });

    function member_del(Obj,id) {
        layer.alert('您确定要删除吗?',function () {
            $.post('{:url(\'member/delete\')}',{id:id},function (res) {
                if (res.code == 200) {
                    layer.msg(res.msg,{icon: 6,time:500},function () {
                        location.reload();
                    });
                }else{
                    layer.msg(res.msg,{icon: 5,time:500});
                }
            });

        })
    }
</script>
</html>